package five;

import java.lang.management.ManagementFactory;

import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.management.modelmbean.RequiredModelMBean;

import one.Hello;

import com.sun.jdmk.comm.HtmlAdaptorServer;

/**
 * 代理层  HelloAgent类
 *
 */
public class HelloAgent {

	public static void main(String[] args) throws Exception {
		MBeanServer server = ManagementFactory.getPlatformMBeanServer();
		ObjectName helloName = new ObjectName("liuys:name=helloWorld");
		//Hello hello = new Hello();
		RequiredModelMBean hello = ModelMBeanUtils.createModelerMBean();
		
		server.registerMBean(hello, helloName);
		
		ObjectName adapterName = new ObjectName("HelloAgent:name=htmladapter,port=8082");
		HtmlAdaptorServer adaptor = new HtmlAdaptorServer();
		server.registerMBean(adaptor, adapterName);
		
		adaptor.start();
		System.out.println("start.....................");
	}
}
